#include "instructionstate.h"

#include "window.h"
#include "gameapplication.h"
#include <QGridLayout>
#include "statemanager.h"

InstructionState::InstructionState()
{
	window_ = new InstructionWidget();
	connect(window_, SIGNAL(closeWindow()), this, SLOT(closeInstruction()));
}

InstructionState::~InstructionState() {
	delete window_;
}

void InstructionState::enter() {
	Window::getLayout()->addWidget(window_,1,1);
	window_->show();
}

void InstructionState::exit() {
	Window::getLayout()->removeWidget(window_);
	window_->hide();
}

void InstructionState::closeInstruction() {
	StateManager::getInstance().setState("menu");
}
